﻿@using Fap.Workflow.Model
@model Fap.AspNetCore.ViewModel.JqGridViewModel
@using Fap.AspNetCore.Controls.JqGrid
@{
    Layout = null;
    string tableName = Model.JqgridId;
    //增加操作列
    Column column = new Column("oper");
    column.SetLabel("操作");
    column.SetSortable(false);
    column.SetSearch(false);
    column.SetWidth(110);
    WfBusiness biz = ViewBag.Business;
}

    <div class="row">
        <div class="col-xs-12">
            <div class="widget-box">
                <div class="widget-header widget-header-flat">
                    <h4 class="widget-title smaller">@biz.BizName</h4>
                </div>

                <div class="widget-body">
                    <div class="widget-main">
                        <fap-grid id="@Model.JqgridId" attach-column="@column" grid-model="Model"  auto-width="true" shrink-fit="false" oper-import="false" on-grid-complete="initOperMenu"></fap-grid>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
    function initOperMenu()
    {
        var ids = jQuery("#grid-@tableName").jqGrid('getDataIDs');
        for (var i = 0; i < ids.length; i++) {
            var de = '';
            var cl = ids[i];
            var ret = jQuery('#grid-@tableName').jqGrid('getRowData', cl);
            var fid = ret.Fid;

            de += "<a  href='javascript:void(0)' onclick='viewApprovalBill(\"@biz.Fid\",\"" + fid + "\")'>"+$.lang("view","查看")+"</a>  ";
            de += "<a  href='javascript:void(0)' onclick='workflowChart(\"@biz.WfProcessUid\",\"" + fid + "\")'>"+$.lang("flow_diagram","流程图")+"</a>";

            jQuery('#grid-@tableName').jqGrid('setRowData', ids[i], { oper: de });
        }
    }
    function refreshList()
    {
        $("#grid-@tableName").trigger("reloadGrid"); //重新载入

    }
    </script>
